import typing
from pydantic_settings import BaseSettings

class Settings(BaseSettings):
    QMT_DIR: str = r'D:\江海证券QMT实盘_交易\userdata_mini'
    ACC: str = "80395788"
    API: str = "http://127.0.0.1:9188/api/data/jiaoyi/add_orders"
    STOCK_CODE: typing.List = [
        {"id": "513130", "name": "恒生科技", "all_code": "513130.SH", "type": 1, "span": 0.001, "volume": 1000,"min_rsi":5,"down":0.003},
        {"id": "513060", "name": "恒生医疗", "all_code": "513060.SH", "type": 1, "span": 0.001, "volume": 1000,"min_rsi":5,"down":0.003},
        {"id": "513120", "name": "港股创新药", "all_code": "513120.SH", "type": 1, "span": 0.001, "volume": 100000,"min_rsi":5,"down":0.003},##1.5
        {"id": "513090", "name": "香港证券", "all_code": "513090.SH", "type": 1, "span": 0.002, "volume": 50000,"min_rsi":5,"down":0.012},##2.3
        {"id": "513050", "name": "中概互联网", "all_code": "513050.SH", "type": 1, "span": 0.001, "volume": 100000,"min_rsi":5,"down":0.003},##中概波动太小只能千1
        {"id": "513750", "name": "港股通非银", "all_code": "513750.SH", "type": 1, "span": 0.001, "volume": 100000,"min_rsi":5,"down":0.005},##1.73
        {"id": "159210", "name": "港股汽车", "all_code": "159210.SZ", "type": 1, "span": 0.001, "volume": 100000,"min_rsi":5,"down":0.005},##1.087
        {"id": "513310", "name": "中韩半导体", "all_code": "513310.SH", "type": 1, "span": 0.002, "volume": 50000,"min_rsi":5,"down":0.008},##1.937
        {"id": "159268", "name": "港股通消费", "all_code": "159268.SZ", "type": 1, "span": 0.001, "volume": 100000,"min_rsi":5,"down":0.005},##1.052
        {"id": "159265", "name": "港股消费", "all_code": "159265.SZ", "type": 1, "span": 0.001, "volume": 100000,"min_rsi": 5,"down":0.005},##1.083
        {"id": "159615", "name": "生物科技", "all_code": "159615.SZ", "type": 1, "span": 0.001, "volume": 100000,"min_rsi":5,"down":0.005},##1.397
        {"id": "159792", "name": "港股通互联网", "all_code": "159792.SZ", "type": 1, "span": 0.001, "volume": 100000,"min_rsi": 5, "down": 0.005},  ##1.397
        {"id": "159605", "name": "中概互联", "all_code": "159605.SZ", "type": 1, "span": 0.001, "volume": 100000,"min_rsi": 5, "down": 0.005},  ##1.397
        {"id": "520500", "name": "恒生创新药", "all_code": "520500.SH", "type": 1, "span": 0.002, "volume": 50000,"min_rsi":5,"down":0.008},##2.067
        # {"id": "510900", "name": "H股", "all_code": "510900.SH", "type": 1, "span": 0.001, "volume": 1000,"min_rsi": 5, "down": 0.008},  ##2.067
        # {"id": "159529", "name": "标普消费", "all_code": "159529.SZ", "type": 1, "span": 0.002, "volume": 1000, "min_rsi": 5,"down": 0.008},  ##2.067
        # {"id": "159612", "name": "标普500", "all_code": "159612.SZ", "type": 2, "span": 0.002, "volume": 1000,
        #  "min_rsi": 5, "down": 0.008},  ##2.067
    ]
    UPDOWN_TIME:int = 60  ##横盘时间,60个tick,约3分钟
    UPDOWN_SPAN:float = 0.2 ##横盘区间大小
    GIVE_SPAN:int = 3 ##止损挡位,往下两档
    # ATR 配置
    ATR_LOOKBACK:int = 14  # 日内分钟级建议 7~14
    ATR_X:float = 0.4      # ATR 倍数（2~5），用于阈值放大
    # 死叉保护时间配置（分钟）
    DEATH_CROSS_PROTECTION_MINUTES:int = 5  # 死叉出现后30分钟内不允许买入
    ##当日股票乐观程度: 1强势下跌2看跌3一般4看涨5强势上涨，可以看自选股红色数量来判断或者新闻情绪
    DAY_LOOK:int = 1 ##默认为3,一般情况


settings = Settings()
